<template>
  <div>
    <el-table v-loading="loading" class="gl_table_noBorder" :data="tableData" size="mini">
      <el-table-column label="序号" type="index" :index="table_index" />
      <el-table-column prop="operatingType" label="事件" />
      <el-table-column prop="operatingAccount" label="操作人" />
      <el-table-column prop="creationTime" label="时间">
        <template slot-scope="{row}">
          <span v-if="row.creationTime">{{ row.creationTime | FormatDate('yyyy-MM-dd HH:mm:ss') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="150">
        <template slot-scope="{ row }">
          <el-button size="mini" type="text" @click="clickCheck(row)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-row class="gl_mt_15" style="text-align: right;">
      <el-pagination
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="selectedMsg.MaxResultCount"
        :current-page="selectedMsg.Page"
        @size-change="changePageSize"
        @current-change="changePage"
      />
    </el-row>
    <operation-detail ref="operationDetail" />
  </div>
</template>

<script>
import operationDetail from './operationDetail.vue';
import {
  Api_GET_ClubStudentCardsLogListSudentMembershipCardIdQO // 分页获取学生卡片的操作日志信息
} from '@/lib/form/hall/swaggerForm';
import {
  api_GET_ClubStudentCardsLogListSudentMembershipCardId // 分页获取学生卡片的操作日志信息
} from '@/extend/api/hallswaggerApi/app';
export default {
  components: { operationDetail },
  data () {
    return {
      selectedMsg: new Api_GET_ClubStudentCardsLogListSudentMembershipCardIdQO(),
      loading: false,
      dialogVisible: false,
      dialogLoading: false,
      total: 0,
      tableData: []
    };
  },
  mounted() {
    console.log(this.$route);
    this.getPageList();
  },
  methods: {
    getPageList(page) {
      if (this.$route.params && this.$route.params.id) {
        this.loading = true;
        api_GET_ClubStudentCardsLogListSudentMembershipCardId(this.$route.params.id, this.selectedMsg).then(res => {
          this.loading = false;
          this.tableData = res.items;
          this.total = res.totalCount;
        }, error => {
          this.loading = false;
          const _msg = error.error.message || error.message;
          this.$message({ type: 'error', message: _msg });
        });
      }
    },
    clickCheck(row) {
      this.$refs.operationDetail.dialogVisible = true;
      this.$refs.operationDetail.operateDetail = row;
    },
    // 分页
    changePage(page) {
      this.getPageList(page);
    },
    changePageSize(pagesize) {
      this.selectedMsg.MaxResultCount = pagesize;
      this.getPageList();
    },
    // 序号递增
    table_index(index) {
      return (this.selectedMsg.Page - 1) * this.selectedMsg.MaxResultCount + index + 1;
    }
  }
};
</script>

<style lang="scss" scoped>

</style>
